package cc.mrbird.febs.business.api;

import cc.mrbird.febs.business.domain.Community;
import cc.mrbird.febs.business.service.CommunityService;
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.domain.QueryRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@Validated
@RestController
@RequestMapping("api/community")
@Api(description = "小区信息接口")
public class CommunityApi extends BaseController {

    @Autowired
    private CommunityService communityService;

    @GetMapping("communityList")
    @ApiOperation(value = "小区列表" ,  notes="小区列表")
    public Map<String, Object> communityList(QueryRequest queryRequest, Community community) {
        return getDataTable(communityService.findCommunitys(community, queryRequest));
    }
}
